import {createBrowserRouter} from 'react-router-dom'
import { lazy } from 'react'
import { AppstoreOutline,UserOutline } from 'antd-mobile-icons'

import Login from '../pages/login/Index'
import Error from '../pages/404/Index'
import Layout from '../pages/layout/Index'
import List from '../pages/list/Index'
import Detail from '../pages/detail/Index'
import User from '../pages/user/Index'
let Home=lazy(()=>import('../pages/home/Index'))
let My=lazy(()=>import('../pages/my/Index'))

export let childroute=[
    {
        path:'/',
        element:<Home></Home>,
        icon:<AppstoreOutline />,
        name:'首页'
    },
     {
        path:'/my',
        element:<My></My>,
        icon:<UserOutline />,
        name:'我的'
    },
]

let route=createBrowserRouter([
    {
        path:'/',
        element:<Layout></Layout>,
        children:childroute
    },
    {
        path:'/login',
        element:<Login></Login>
    },
    {
        path:'/list',
        element:<List></List>
    },
     {
        path:'/user',
        element:<User></User>
    },
     {
        path:'/detail',
        element:<Detail></Detail>
    },
    {
        path:"*",
        element:<Error></Error>
    }
])
export default route